import requests
newsurl='http://news.sina.com.cn/c/2018-05-28/doc-ihcffhsu5347631.shtml'
res=requests.get(newsurl)
res.encoding='utf-8'
sample=res.text
from bs4 import BeautifulSoup
soup=BeautifulSoup(sample,'html.parser')

timesource=soup.select('.date')[0].text
type(timesource)
from datetime import datetime
dt=datetime.strptime(timesource,'%Y年%m月%d日 %H:%M')
print(dt.strftime('%Y-%m-%d %H-%M'))


#texts=soup.select('#article')[0].text
#print(texts)

#for p in soup.select('#article p')[:-2]:
#    print(p.text.strip())

#简写方式，同上
[print(p.text.strip()) for p in soup.select('#article p')[:-2]]
    